<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>角色分配</title>
<%@ include file="/resources/jsp/rootPath.jsp"%>
</head>
<body>
	<%@ include file="/resources/jsp/header.jsp"%>

	<!-- content start -->
	<div class="am-cf admin-main">
		<%@ include file="/resources/jsp/left.jsp"%>
		<!-- content start -->
		<div class="admin-content">
			<div class="am-cf am-padding">
				<div class="am-cf am-padding">
					<div class="am-fl am-cf">
						<strong class="am-text-primary am-text-lg">角色分配</strong> / <small>SysAuthRole</small>
					</div>
				</div>

				<div class="am-g">
					<div class="am-u-sm-12 am-u-md-6">
						<div class="am-btn-toolbar">
							<div class="am-btn-group am-btn-group-xs">
								<button type="button" class="am-btn am-btn-default"
									onclick="add()"
									data-am-modal="{target: '#doc-modal-1', closeViaDimmer: 0, width: 800, height: 625}">
									<span class="am-icon-plus"></span> 新增
								</button>
								<button type="button" class="am-btn am-btn-default">
									<span class="am-icon-save"></span> 保存
								</button>
								<button type="button" class="am-btn am-btn-default">
									<span class="am-icon-archive"></span> 审核
								</button>
								<button type="button" class="am-btn am-btn-default">
									<span class="am-icon-trash-o"></span> 删除
								</button>
							</div>
						</div>
					</div>
					<div class="am-u-sm-12 am-u-md-3">
						<div class="am-form-group">
							<select data-am-selected="{btnSize: 'sm'}">
								<option value="option1">所有类别</option>
								<option value="option2">IT业界</option>
								<option value="option3">数码产品</option>
								<option value="option3">笔记本电脑</option>
								<option value="option3">平板电脑</option>
								<option value="option3">只能手机</option>
								<option value="option3">超极本</option>
							</select>
						</div>
					</div>
					<div class="am-u-sm-12 am-u-md-3">
						<div class="am-input-group am-input-group-sm">
							<input type="text" class="am-form-field"> <span
								class="am-input-group-btn">
								<button class="am-btn am-btn-default" type="button">搜索</button>
							</span>
						</div>
					</div>
				</div>

				<div class="am-g">
					<div class="am-u-sm-12">
						<form class="am-form">
							<table
								class="am-table am-table-striped am-table-hover table-main">
								<thead>
									<tr>
										<th class="table-check"><input type="checkbox" /></th>
										<th class="table-title">角色名</th>
										<th class="table-type">别名</th>
										<th class="table-author am-hide-sm-only">模块路径</th>
										<th class="table-date am-hide-sm-only">描述</th>
										<th class="table-set">操作</th>
									</tr>
								</thead>
								<tbody>
									<c:forEach items="${page.rows }" var="model">
										<tr>
											<td><input type="checkbox" /></td>
											<td><a href="#">${model.fdName }</a></td>
											<td>${model.fdAlias }</td>
											<td class="am-hide-sm-only">${model.fdModulePath}</td>
											<td class="am-hide-sm-only">${model.fdDescription }</td>
											<td>
												<div class="am-btn-toolbar">
													<div class="am-btn-group am-btn-group-xs">
														<button type="button" onclick="edit('${model.fdId }')"
															class="am-btn am-btn-default am-btn-xs am-text-secondary">
															<span class="am-icon-pencil-square-o"></span> 编辑
														</button>
														<button type="button" onclick="addPerson('${model.fdId }')"
															class="am-btn am-btn-default am-btn-xs am-text-secondary">
															<span class="am-icon-user-plus"></span> 角色分配
														</button>
														<button type="button" onclick="del('${model.fdId }')"
															class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only">
															<span class="am-icon-trash-o"></span> 删除
														</button>
													</div>
												</div>
											</td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
							<div class="am-cf">
								共 ${page.totalSize} 条记录
								<div class="am-fr">
									<ul class="am-pagination">

									</ul>
								</div>
							</div>
							<hr />
							<p>注：.....</p>
						</form>
					</div>

				</div>
			</div>
		</div>

	</div>

	<div class="am-modal am-modal-confirm" tabindex="-1" id="my-confirm">
	  <div class="am-modal-dialog">
	    <div class="am-modal-bd">
	      你，确定要删除这条记录吗？
	    </div>
	    <div class="am-modal-footer">
	      <span class="am-modal-btn" data-am-modal-cancel>取消</span>
	      <span class="am-modal-btn" data-am-modal-confirm>确定</span>
	    </div>
	  </div>
	</div>

	<%@ include file="/resources/jsp/foot.jsp"%>
</body>
<script type="text/javascript">
	$(document).ready(function() {
		//初始化页数
		pagination("${page.totalPage}", "${page.pageNo}");
	});

	function add() {
		window.location.href="${root}/sys/organization/addSysAuthRole.do";
	}
	
	function addPerson(fdId) {
		window.location.href="${root}/sys/organization/addSysAuthRolePerson.do?fdId="+fdId;
	}
	
	function edit(fdId){
		window.location.href="${root}/sys/organization/editSysAuthRole.do?fdId="+fdId;
	}
	
	function del(fdId){
		      $('#my-confirm').modal({
		        relatedTarget: this,
		        onConfirm: function(options) {
		        	 $.ajax({
		                 type: "get",
		                 url: "${root}/sys/organization/delSysAuthRole.do",
		                 data: {fdId:fdId},
		                 dataType: "json",
		                 success: function(data){
		                	 if(data=="true"){
		                		 window.location.href="${root}/sys/organization/sysAuthRole.do";
		                	 }
		                 }
		    		 });
		        }
		      });
	}
	
	
</script>
</html>